Title: x86assembly - ch4 - addressing sections only

Direct addressing is rarely used for array processing because it is impractical to use constant offsets to address more than a few array elements. Instead, a register is used as a pointer and that register's value is manipulated. When an operand uses this indirect addressing, it is called an indirect operand.
url: http://www.c-jump.com/CIS77/ASM/Addressing/lecture.html

Q: An [...] [...] can be any 32-bit general purpose register surrounded by [...]. The register is assumed to contain the address of data.
A: indirect; operand; brackets [ ]
Extra: 1
2
3
4
5
.data
  byteVal BYTE 10
.code
  mov esi, OFFSET byteVal
  mov al, [esi]                          ; AL=10
url: http://www.c-jump.com/CIS77/ASM/Addressing/lecture.html
Topic: addresses

Q: When using [...] [...], the size of the operand may not be evident from the context of the instruction, which will generate an "operand must have size" error.
The [...] operator confirms the operand size and casts the operand to that size if necessary.
A: indirect; operands; PTR
Extra: 1
2
3
4
5
6
7
mov esi, OFFSET my_array  ; address of my_array
inc BYTE PTR[esi]         ; 9 becomes 10
movzx eax, BYTE PTR[esi]  ; move 10 to ax
call WriteInt             ; prints 10
inc esi                   ; increment address, now points to 16
movzx eax, BYTE PTR[esi]
call WriteInt             ; prints 16
url: http://www.c-jump.com/CIS77/ASM/Addressing/lecture.html
Topic: addressing

Q: When using [...] [...] to reference an array, the amount to increment the address by depends on the [...] of the array elements. For an array of bytes, the increment is 1. For words, it is 2, and so forth.
A: indirect; addressing; size
Extra: 1
 2
 3
 4
 5
 6
 7
 8
 9
10
.data
 my_array WORD 1000, 2000, 3000
.code
 mov esi, OFFSET my_array
 mov ax, [esi]
 add esi, 2
 mov ax, [esi]
 add esi, 2
 mov ax, [esi]
url: http://www.c-jump.com/CIS77/ASM/Addressing/lecture.html
Topic: addressing

An indexed operand adds a constant to a register to generate an effective address. Any general purpose register may be used as an indexed register.
Syntax: constant[reg]        Alternate: [constant + reg]
indexed operands are ideal for array processing but the index register should be initialized to zero before accessing the first array element.
Extra: 1
2
3
4
5
.data
  array_bytes BYTE 10,20,50
.code
  mov esi, 0
  mov al, array_bytes[esi]
url: http://www.c-jump.com/CIS77/ASM/Addressing/lecture.html#R77_0080_addressing_operands
Topic: addressing

Q: Another type of indexed addressing combines a register with a [...] offset. The index register holds the base [...] of an array or structure and the constant identifies [...].
A: constant; address; offsets
Extra: 1
2
3
4
5
6
7
.data
    arrayW WORD 1000h,2000h,3000h
    .code
    mov    esi,OFFSET arrayW
    mov    ax,[esi]                ; AX = 1000h
    mov    ax,[esi+2]                ; AX = 2000h
    mov    ax,[esi+4]                ; AX = 3000h
Topic: addresses